package berlinatyourfingertips.ua.apis;

import processing.xml.XMLElement;

/**
 * Get environmental information about a GeoPosition
 * @author Denny Koch
 *
 */
public final class UAGeoEnvironment {

	/**
	 * For now it returns a String, but maybe a nicer form is added
	 * @param latitude
	 * @param longitude
	 * @return String
	 */
	public static String getLocalTimeOf(float latitude, float longitude) {
		System.out.println("GeoEnvironment (LocalTime): request startet.");
		
		String httpResult = UAHttp.get("http://www.earthtools.org/timezone/"+latitude+"/"+longitude);
		
		System.out.println("GeoEnvironment (LocalTime): parsing result.");
		
		XMLElement xml = new XMLElement(httpResult);
		return xml.getChild("localtime").getContent();
	}

	public static void main(String arg[]) {
		System.out.println(UAGeoEnvironment.getLocalTimeOf(52.31f, 13.20f));
	}

}